import {Component, Input} from '@angular/core';
import {App, NavController} from "ionic-angular";
import {BozhuinfoPage} from "../../pages/bozhuinfo/bozhuinfo";
import {DomSanitizer} from "@angular/platform-browser";
import {JidihttpProvider} from "../../providers/jidihttp/jidihttp";

/**
 * Generated class for the BozhulistComponent component.
 *
 * See https://angular.io/api/core/Component for more info on Angular
 * Components.
 */
@Component({
  selector: 'bozhulist',
  templateUrl: 'bozhulist.html'
})
export class BozhulistComponent {

  @Input() listitembozhu:any;
  @Input() isshowSearch:boolean=false;
  uname:string="";
  fuwenben:string;
  pageNo:number=1;

  constructor(public navCtrl: NavController,private app:App,public sanitizer:DomSanitizer,public jidiProvider:JidihttpProvider) {
    console.log('Hello BozhulistComponent Component');
  }

  querymore(uuid){
    this.app.getRootNav().push(BozhuinfoPage,{uuid:uuid});
  }


  assembleHTML(strHTML:any){
    return this.sanitizer.bypassSecurityTrustHtml(strHTML);
  }

  sreach(pageno){
    this.jidiProvider.getBozhuHttpByName(pageno,this.uname)
      .subscribe(data => {
        if(data['data']['records']['length']>0){
          this.listitembozhu=[];
          for(let i=0;i<data['data']['records']['length'];i++){
            this.listitembozhu.push(data['data']['records'][i]);
          }
        }
      })
  }



}
